ARG PHP_VERSION=8.3
# 镜像 具体版本
FROM php:${PHP_VERSION}-fpm-alpine

# 安装 Composer
ENV COMPOSER_HOME /root/composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ENV PATH $COMPOSER_HOME/vendor/bin:$PATH
RUN composer conf -g repo.packagist composer https://mirrors.aliyun.com/composer/

#使用sed工具将字符串dl-cdn.alpinelinux.org替换为mirrors.aliyun.com
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#包更新
RUN apk update

# 安装git
RUN apk add git

#安装数据库扩展
RUN docker-php-ext-install pdo pdo_mysql

#bcmath
RUN docker-php-ext-install bcmath

RUN addgroup -g 1000 -S www && \
    adduser -u 1000 -S www -G www

#USER root

COPY --chown=www:www-data . /var/www

RUN chown -R www:www-data /var/www
RUN chmod -R ug+w /var/www
